home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 1 / BBS in a box - Trilogy I.iso / Files / Publish / J-L / lpr / lpr source / switcher.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-20  |  1.3 KB  |  69 lines  |  [TEXT/MPS ]

  1. #if !defined(USEDUMP)
  2.     #include "lprlib.h"
  3.     #include "lprdef.h"
  4.     #include "lprfuncs.h"
  5. #else
  6.     #pragma load "lprDumpFile"
  7. #endif
  8.  
  9. extern unsigned char sw_bgrnd;
  10. extern unsigned char mf_bgrnd;
  11.  
  12. extern DialogPtr statptr;
  13.  
  14. extern bgproc();    /* assembler routine to get background calls */
  15.  
  16. void sw_suspend(void)
  17. {
  18. WorldTable * wt, * get_world();
  19.  
  20. if (!sw_active()) {
  21.     mf_bgrnd = 1;
  22.     if (statptr) statGrowIcon();
  23.     return;
  24.     }
  25. sw_bgrnd = 1;             /* indicate backgound mode pending */
  26. wt = get_world();        /* install background routine */    
  27. wt->WTBgtask = (ProcPtr)&bgproc; 
  28. }
  29.  
  30. void sw_resume(void)
  31. {
  32. WorldTable * wt, * get_world();
  33.  
  34. if (mf_bgrnd == 1) {
  35.     if (statptr) {
  36.         SelectWindow(statptr);
  37.         statGrowIcon();
  38.         }
  39.     mf_bgrnd = 0;
  40.     }
  41. if (sw_bgrnd == 0) return;
  42.  
  43. sw_bgrnd = 0;            /* indcate no longer in background */
  44. wt = get_world();        /* de-install background routine */
  45. wt->WTBgtask = 0;
  46. if (statptr) statGrowIcon();
  47. }
  48.  
  49. short sw_active(void)    /* tell caller if we're under Switcher */
  50. {
  51. static long * sw_globals = 0x282;
  52.  
  53. if ((*sw_globals) == 0) return(0);
  54. if ((*sw_globals) == -1) return(0);
  55. return(1);
  56. }
  57.  
  58. WorldTable * get_world()
  59. {
  60. static unsigned long * ApplZone = 0x2aa;
  61.  
  62. return((WorldTable *)((*ApplZone) - 18));
  63. }
  64.  
  65. void sw_proc(void)                /* called as background process */
  66. {
  67. tcpevent();
  68. }
  69.